package com.jdwx.opengl.interfaces;

import android.os.Build;

import androidx.annotation.RequiresApi;


class A implements  Electronic{
    public static void main(String[] args){
        A a = new A();
        a.getElectricityUse();
        //匿名类
        Electronic e = new Electronic(){

            @Override
            public int getElectricityUse() {
                return 0;
            }
        };
        System.out.println( e.getElectricityUse() );
    }

    @Override
    public int getElectricityUse() {
        System.out.println(LED);
        return 0;
    }

}

public interface Electronic {
    // 常量
    String LED = "LED";

    // 抽象方法
    int getElectricityUse();

    // 静态方法
    @RequiresApi(api = Build.VERSION_CODES.N)
    static boolean isEnergyEfficient(String electtronicType) {
        return electtronicType.equals(LED);
    }

    // 默认方法
    @RequiresApi(api = Build.VERSION_CODES.N)
    default void printDescription() {
        System.out.println("电子");
    }
}

